import java.util.Hashtable;
import java.util.Enumeration;

public class FeniusDraftDomain 
{
    public String name = null;
    public String display = null;
    public String url = null;
    public Hashtable<String, String> endpoints = null;
    public Hashtable<String, FeniusDraftRoute> routes = null;

    public FeniusDraftDomain(String name, String url, String display) 
    {
	this.name = name;
	this.display = display;
	this.url = url;

	endpoints = new Hashtable<String, String>();
	routes = new Hashtable<String, FeniusDraftRoute>();
    }

    public String getName()
    {
	return name;
    }

    public String getDisplayName()
    {
	return display;
    }

    public void addEndpoint(String endpoint)
    {
	endpoints.put(endpoint, endpoint);
    }

    public void addRoute(FeniusDraftRoute route) 
    {
	routes.put(route.getDestination(), route);
    }

    public FeniusDraftRoute getRoute(String domain)
    {
	return routes.get(domain);
    }

    public String toString()
    {
	String s = name + ", " + url + "\n";

	for( Enumeration e = endpoints.elements(); e.hasMoreElements(); ){
	    s += "\tendpoint:" + e.nextElement() + "\n";
	}
	for( Enumeration e = routes.elements(); e.hasMoreElements(); ){
	    s += "\troute:" + ((FeniusDraftRoute) e.nextElement()).toString() + "\n";
	}

	return s;
    }

    public FeniusDraftRoute searchRoute(String destination)
    {
	FeniusDraftRoute route = routes.get(destination);
	return route;
    }
}
